<?php 
	
class Restaurant
{
	var $pdo = null;
    var $logger = null;
    function __construct()
    {
        $this->pdo = PDOWrapper::instance();
        $this->logger = CLog::getInstance();
    }

    /**
     * @return array|bool
     * 
     * 饭店
     */
    function RestaurantV1($GetParams, $PostArray){
    	
        $user_info = User::GetInfoByToken($GetParams['token']);
        if($user_info === false) {
            return false;
        }
        
        $params = [
            'r_id' => $user_info['r_id']
        ];
        $field = [
            'r_id','r_name','r_location','r_logo','province','city','detail','price','opening','phone'
        ];
        $r_info = $this->pdo->select('restaurant', $field, $params);
        if (empty($r_info)) {
            Utils::ShowError(ErrorDefine::ILLEGALL_RESTAURANT);
            return false;
        }

        $params = [
            'r_id' => $user_info['r_id'],
        ];
        $field = [
            'r_pic_url'
        ];
        $pic_list = $this->pdo->select('restaurant_pic', $field, $params);

        $params = [
            'r_id' => $user_info['r_id'],
            'status' => 1
        ];
        $field = [
            'label_name'
        ];
        $label_list = $this->pdo->select('restaurant_label', $field, $params);
      	
      	$r_info[0]['pic_list'] = $pic_list;
        $r_info[0]['label_list'] = $label_list;

        $message = $r_info[0];
        Utils::ShowMessage($message);
        return true;
    }
	
}